package cn.kgc.service;

import cn.kgc.entity.Student;
import cn.kgc.mapper.StudentMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Component
@Transactional
public class StudentServiceImpl implements StudentService {
    @Resource
    private StudentMapper studentMapper;
    @Override
    public PageInfo<Student> getAll(Integer pn) {
        PageHelper.startPage(pn,3);
        return new PageInfo<>(studentMapper.getAll());
    }

    @Override
    public boolean add(Student student) {
        return studentMapper.add(student)==1;
    }
}
